package com.acsior.hibernate.vo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

import com.acsior.dac.impl.hibernate.vo.GeneratorKey;
import com.acsior.dac.impl.hibernate.vo.HibernatePersistantIntegerIdVO;

/**
 * SubscriptionCatalog entity. @author MyEclipse Persistence Tools <b><i>powered
 * by Belev</i></b>
 */
@Entity
@Table(name = "subscription_catalogs", uniqueConstraints = @UniqueConstraint(columnNames = {
		"catalog_number", "catalog_date" }))
@GeneratorKey(tableName = "subscription_catalogs")
public class SubscriptionCatalogVO extends HibernatePersistantIntegerIdVO {

	private static final long serialVersionUID = -3285050313253658168L;

	@Temporal(TemporalType.DATE)
	@Column(name = "catalog_date", nullable = false, length = 10)
	private Date catalogDate;

	@Column(name = "catalog_number", nullable = false, length = 50)
	private String catalogNumber;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "crCodeID", nullable = false)
	private CdCRCodeVO cdCRCode;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "contragent_id", nullable = false)
	private ContragentVO contragent;

	@Column(name = "discontinued", nullable = false)
	private boolean discontinued;

	@Temporal(TemporalType.DATE)
	@Column(name = "end_date", nullable = false, length = 10)
	private Date endDate;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "nom_publication_kind_id", nullable = false)
	private NomPublicationKindVO nomPublicationKind;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "nom_publication_type_id", nullable = false)
	private NomPublicationTypeVO nomPublicationType;

	@Column(name = "number_per_year", nullable = false)
	private Integer numberPerYear;

	@Column(name = "post_delivery", nullable = false)
	private boolean postDelivery;

	@Column(name = "publication_name", nullable = false)
	private String publicationName;

	@Column(name = "return_money", nullable = false)
	private boolean returnMoney;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "structure_id", nullable = false)
	private StructureVO structure;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "subscriptionCatalog")
	private List<SubscriptionPlanVO> subscriptionPlans;

	@Column(name = "union_number", length = 50)
	private String unionNumber;

	/** default constructor */
	public SubscriptionCatalogVO() {
		this.subscriptionPlans = new ArrayList<SubscriptionPlanVO>();
	}

	/** @return the catalogDate */
	public Date getCatalogDate() {
		return this.catalogDate;
	}

	/** @return the catalogNumber */
	public String getCatalogNumber() {
		return this.catalogNumber;
	}

	/** @return the cdCRCode */
	public CdCRCodeVO getCdCRCode() {
		return this.cdCRCode;
	}

	/** @return the contragent */
	public ContragentVO getContragent() {
		return this.contragent;
	}

	/** @return the endDate */
	public Date getEndDate() {
		return this.endDate;
	}

	/** @return the nomPublicationKind */
	public NomPublicationKindVO getNomPublicationKind() {
		return this.nomPublicationKind;
	}

	/** @return the nomPublicationType */
	public NomPublicationTypeVO getNomPublicationType() {
		return this.nomPublicationType;
	}

	/** @return the numberPerYear */
	public Integer getNumberPerYear() {
		return this.numberPerYear;
	}

	/** @return the publicationName */
	public String getPublicationName() {
		return this.publicationName;
	}

	/** @return the structure */
	public StructureVO getStructure() {
		return this.structure;
	}

	/** @return the subscriptionPlans */
	public List<SubscriptionPlanVO> getSubscriptionPlans() {
		return this.subscriptionPlans;
	}

	/** @return the unionNumber */
	public String getUnionNumber() {
		return this.unionNumber;
	}

	/** @return the discontinued */
	public boolean isDiscontinued() {
		return this.discontinued;
	}

	/** @return the postDelivery */
	public boolean isPostDelivery() {
		return this.postDelivery;
	}

	/** @return the returnMoney */
	public boolean isReturnMoney() {
		return this.returnMoney;
	}

	/** @param catalogDate */
	public void setCatalogDate(Date catalogDate) {
		this.catalogDate = catalogDate;
	}

	/** @param catalogNumber */
	public void setCatalogNumber(String catalogNumber) {
		this.catalogNumber = catalogNumber;
	}

	/** @param cdCRCode */
	public void setCdCRCode(CdCRCodeVO cdCRCode) {
		this.cdCRCode = cdCRCode;
	}

	/** @param contragent */
	public void setContragent(ContragentVO contragent) {
		this.contragent = contragent;
	}

	/** @param discontinued */
	public void setDiscontinued(boolean discontinued) {
		this.discontinued = discontinued;
	}

	/** @param endDate */
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	/** @param nomPublicationKind */
	public void setNomPublicationKind(NomPublicationKindVO nomPublicationKind) {
		this.nomPublicationKind = nomPublicationKind;
	}

	/** @param nomPublicationType */
	public void setNomPublicationType(NomPublicationTypeVO nomPublicationType) {
		this.nomPublicationType = nomPublicationType;
	}

	/** @param numberPerYear */
	public void setNumberPerYear(Integer numberPerYear) {
		this.numberPerYear = numberPerYear;
	}

	/** @param postDelivery */
	public void setPostDelivery(boolean postDelivery) {
		this.postDelivery = postDelivery;
	}

	/** @param publicationName */
	public void setPublicationName(String publicationName) {
		this.publicationName = publicationName;
	}

	/** @param returnMoney */
	public void setReturnMoney(boolean returnMoney) {
		this.returnMoney = returnMoney;
	}

	/** @param structure */
	public void setStructure(StructureVO structure) {
		this.structure = structure;
	}

	/** @param subscriptionPlans */
	public void setSubscriptionPlans(List<SubscriptionPlanVO> subscriptionPlans) {
		this.subscriptionPlans = subscriptionPlans;
	}

	/** @param unionNumber */
	public void setUnionNumber(String unionNumber) {
		this.unionNumber = unionNumber;
	}
}